*/
#define MIN_HORIZONTAL_BAR_WIDTH 150
-#define MIN_HORIZONTAL_BAR_HEIGHT 20
-#define MIN_VERTICAL_BAR_WIDTH 22
+#define MIN_HORIZONTAL_BAR_HEIGHT 6
+#define MIN_VERTICAL_BAR_WIDTH 7
#define MIN_VERTICAL_BAR_HEIGHT 80
cairo_t *cr,
GtkOrientation orientation,
gboolean inverted,
+ int x,
+ int y,
int width,
int height)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_progress_bar_get_activity (pbar, orientation, &area.x, &area.width);
- area.y = padding.top;
+ area.y = y + padding.top;
area.height = height - padding.top - padding.bottom;
}
else
{
gtk_progress_bar_get_activity (pbar, orientation, &area.y, &area.height);
- area.x = padding.left;
+ area.x = x + padding.left;
area.width = width - padding.left - padding.right;
}
gint amount,
GtkOrientation orientation,
gboolean inverted,
+ int x,
+ int y,
int width,
int height)
{
{
area.width = amount;
area.height = height - padding.top - padding.bottom;
- area.y = padding.top;
+ area.y = y + padding.top;
if (!inverted)
- area.x = padding.left;
+ area.x = x + padding.left;
else
area.x = width - amount - padding.right;
}
{
area.width = width - padding.left - padding.right;
area.height = amount;
- area.x = padding.left;
+ area.x = x + padding.left;
if (!inverted)
- area.y = padding.top;
+ area.y = y + padding.top;
else
area.y = height - amount - padding.bottom;
}
PangoRectangle logical_rect;
GdkRectangle prelight_clip, start_clip, end_clip;
gfloat text_xalign = 0.5;
- gfloat text_yalign = 0.5;
+ gfloat text_yalign = 0.0;
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
GtkStateFlags state;
GtkBorder padding;
int width, height;
+ int bar_width, bar_height;
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ bar_height = MIN_HORIZONTAL_BAR_HEIGHT;
+ bar_width = width;
+ }
+ else
+ {
+ bar_width = MIN_VERTICAL_BAR_WIDTH;
+ bar_height = height;
+ }
+
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);
- gtk_render_background (context, cr, 0, 0, width, height);
- gtk_render_frame (context, cr, 0, 0, width, height);
+ gtk_render_background (context, cr, width - bar_width, height - bar_height, bar_width, bar_height);
+ gtk_render_frame (context, cr, width - bar_width, height - bar_height, bar_width, bar_height);
gtk_style_context_restore (context);
{
gtk_progress_bar_paint_activity (pbar, cr,
orientation, inverted,
- width, height);
+ width - bar_width, height - bar_height,
+ bar_width, bar_height);
if (priv->show_text)
{
gint space;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- space = width - padding.left - padding.right;
+ space = bar_width - padding.left - padding.right;
else
- space = height - padding.top - padding.bottom;
+ space = bar_height - padding.top - padding.bottom;
amount = space * gtk_progress_bar_get_fraction (pbar);
- gtk_progress_bar_paint_continuous (pbar, cr, amount, orientation, inverted, width, height);
+ gtk_progress_bar_paint_continuous (pbar, cr, amount, orientation, inverted,
+ width - bar_width, height - bar_height,
+ bar_width, bar_height);
if (priv->show_text)
gtk_progress_bar_paint_text (pbar, cr, -1, amount, orientation, inverted, width, height);